import { defHttp } from '@/utils/http';

export interface PermissionData {
  objectParentId?: string | null;
  objectId: string;
  objectType: string;
  targetUser: string;
  userAttribute?: string | Object;
}

// 增加授权
export const addPermission = (data: PermissionData) =>
  defHttp.post({ url: '/devops/api/sys/ngac/addNgacPermission', data });

// 删除授权
export const delPermission = (data: PermissionData) =>
  defHttp.post({ url: '/devops/api/sys/ngac/removeNgacAssociate', data });

// 查询授权
export const queryPermission = (data: Partial<PermissionData>) =>
  defHttp.post({ url: '/devops/api/sys/ngac/findNgacAssociate', data });

// 查询当前登录用户信息
export const getCurrentUserInfo = () => defHttp.get({ url: '/devops/api/sys/user/getCurrentUserInfo' });

// 查询当前用户拥有的菜单
export const getMenus = () => defHttp.get({ url: '/devops/api/sys/menu/getCurrentUserMenus' });

// 查询某个⽤⼾的消息
export const queryUserMessage = (data: any) => defHttp.post({ url: '/devops/msg/findUserMessagePageList', data });

// 设置读取某条消息
export const userTagsReadMessages = (data: any) => defHttp.post({ url: '/devops/msg/userTagsReadMessages', data });

// 查询⽤⼾未读消息
export const getUserUnReadMessageCount = (data: any) =>
  defHttp.post({ url: '/devops/msg/getUserUnReadMessageCount', data });
